﻿@model GridMvc.Site.Models.Grids.OrdersGrid
@{
    ViewBag.Title = "Home Page";
}

<div class="row">
    <div class="col-md-12">
        <h1>Orders administration</h1>
        <p>
            This page demonstrates the possibilities of Grid.Mvc. For more documentation, please
            see: <a href="http://gridmvc.codeplex.com/">http://gridmvc.codeplex.com/</a>
        </p>
    </div>
    <div class="col-md-12">
        @Html.Partial("_OrdersGridCode")
    </div>
</div>

<div class="row">
    <div class="col-md-3 col-md-push-9">
        <h4>
            Order details
        </h4>
        <div id="order-content">
            <p class="muted">
                Select order to display detailed infomation
            </p>
        </div>
    </div>
    <div class="col-md-9 col-md-pull-3">
        @Html.Action("Grid") @* configure grid in a partial view *@
    </div>
</div>
<script>
    $(function () {
        pageGrids.ordersGrid.addFilterWidget(new CustomersFilterWidget());

        pageGrids.ordersGrid.onRowSelect(function (e) {
            $.post("/Home/GetOrder?id=" + e.row.OrderID, function (data) {
                if (data.Status <= 0) {
                    alert(data.Message);
                    return;
                }
                $("#order-content").html(data.Content);
            });
        });
    });
</script>
